package com.zhuiyun.project.cyclingapplet.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhuiyun.project.cyclingapplet.entity.SysUser;
import com.zhuiyun.project.cyclingapplet.mapper.SysUserMapper1;
import com.zhuiyun.project.cyclingapplet.service.ILogonService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

/**
 * @ClassName LogonServiceImpl
 * @Description 用户登录service接口实现类
 * @Author QiaoYuXin
 * @Date 2024/8/1 9:02
 **/
@Service
public class LogonServiceImpl extends ServiceImpl<SysUserMapper1, SysUser> implements ILogonService {

    @Autowired
     SysUserMapper1 sysUserMapper1;

    @Override
    public Map<String, Object> logon(SysUser sysUser) {
        Map<String, Object> m = new HashMap<>();
        //新建对象并且接收查询到的值
        SysUser sysUser_return = sysUserMapper1.logon(sysUser);
        if(sysUser_return != null){
            m.put("code","0000");
            m.put("msg","登录成功");
        }else {
            m.put("code","1111");
            m.put("msg","手机号或密码错误，请重新输入");
        }

        return m;
    }
}
